<template>
	<!-- :style="{height:screenHeight+'px'}" -->
	 <!-- :style="{height:screenHeight+'px'}" -->
	<view>
		<view class="pages u-flex-column">
			<view>
				<view class="notice_warp u-flex-y-center" v-if="text1!=''">
					<view class="notice_icon">
						<image :src="`${$http_cos}/static/notice.png`"></image>
					</view>
					<u-notice-bar class="notice" color="#FFFFFF" :text="text1" fontSize="28" bgColor="#FF7612" icon=""
						speed="80"></u-notice-bar>
				</view>
				<view class="u-flex-between u-flex-y-center title_bar">
					<text class="left_title">上墙推荐</text>
					<view class="right_btn u-flex-y-center u-flex-center" @click="showSex=true">
						<image :src="`${$http_cos}${sex_label=='男'?'/static/%E7%94%B7%E5%AD%A9%20%E6%8B%B7%E8%B4%9D':'/static/%E5%A5%B3%E5%AD%A9'}.png`" ></image>
						<text class="sex_text">{{sex_label}}</text>
						<image :src="`${$http_cos}/static/down.png`" mode="widthFix"></image>
					</view>
				</view>
			</view>
			<view class="swiper_height u-flex-1">
				<swiper class="swiper" :circular="circular" :duration="duration" previous-margin="40rpx" :current="current"
					next-margin="30rpx" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
					@change="change">
					<swiper-item v-for="(item,index) in list3" :key="index" @click="skip(item)">
						<view class="item u-flex-column" :class="index==current?'item1':'item2'">
							<view class="avatar">
								<image :src="get_src(item.matchmakerMeitu)" mode="aspectFill"></image>
							</view>
							<view class="u-flex-1 item_botton">
								<view class="u-flex u-flex-between item_top">
									<view class="u-flex-y-center">
										<text>ID:{{item.userId}}</text>
										<view class="sex">
											<image :src="`${$http_cos}${item.sex=='男'?'/static/boy':'/static/%E5%A5%B3'}.png`" mode="heightFix"></image>
										</view>
									</view>
									<text>“{{item.descriptiveDescription}}”</text>
								</view>
								<view class="info_introduce">
									<text>
										{{item.title}}
									</text>
								</view>
							</view>
						</view>
					</swiper-item>
				</swiper>
			</view>
			<view class="operation_reminder" v-show="is_operation">
				<image src="`${$http_cos}/static/%E6%93%8D%E4%BD%9C%E6%8F%90%E9%86%92.png`"></image>
				<view @click="is_operation=false" class="know"></view>
			</view>
		</view>
		
		<u-picker :show="showSex" :immediateChange="immediateChange" :showToolbar="showToolbar" :columns="actions" :itemHeight="80" title="性别"
			@cancel="showSex=false" @close="showSex=false" keyName="name" closeOnClickOverlay @confirm="sexSelect"></u-picker>
	</view>
</template>

<script>
	import {
		getMessage,
		getWallList
	} from '@/common/api.js'
	const app = getApp();
	export default {
		data() {
			return {
				immediateChange:true,
				$http_cos:app.$http_cos,
				is_operation:true,
				showToolbar:false,
				sex_label:'男',
				actions:[[{
						name: '男',
					},
					{
						name: '女',
					},
				]],
				showSex:false,
				safeAreaInsets:'',
				screenHeight: '',
				circular: true,
				duration: 500,
				current: 0,
				indicatorDots: false,
				autoplay: false,
				interval: 5000,
				list3: [],
				text1: ''
			}
		},
		onLoad() {
			
		},
		onReady() {
			uni.getSystemInfo({
				success: (res) => {
					let bottom=res.safeAreaInsets.bottom==0?34:res.safeAreaInsets.bottom
					
					this.screenHeight = Number(res.windowHeight)-bottom
				},
			})

			// this.screenHeight = uni.getSystemInfoSync().windowHeight
		},
		onShow() {
			
			this.$wxShare(0)
			setTimeout(()=>{
				uni.setTabBarStyle({
					borderStyle: 'white'
				})
			},1000)
			if(uni.getStorageSync('first_operation')){
					this.is_operation=false
			}else{
				this.is_operation=true
				uni.setStorageSync('first_operation',true)
			}
			this.get_WallList()
			this.get_Message()
		},
		methods: {
			skip(item){
				uni.navigateTo({
					url:'/pagesA/square_details/index?id='+item.userId
				})
			},
			sexSelect(e){
			this.sex_label=e.value[0].name
			this.showSex=false
			this.get_WallList()
			},
			get_src(it){
				let {url}=JSON.parse(it)[0]
					// return url+'?watermark/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn/gravity/northwest'
				return url+'?imageView2/2/w/750/h/q/85'
			},
			getClientHeight() {
				const res = uni.getSystemInfoSync()
				const system = res.platform
				if (system === 'os') {
					return 44 + res.statusBarHeight
				} else if (system === 'android') {
					return 48 + res.statusBarHeight
				} else {
					return 0
				}
			},

			noticeChange(e) {

			},
			get_WallList(){
				let data={
					params: {
						sex:this.sex_label
					}
				}
					getWallList(data,{
					custom: {
						auth: false,
						toast: false,
						catch: false
					}
				}).then((r) => {
					this.list3 = r
				}).catch((err) => {

				})
			},
			get_Message() {
				
				getMessage({
					custom: {
						auth: false,
						toast: false,
						catch: false
					}
				}).then((r) => {
					this.text1 = r.content
				}).catch((err) => {

				})
			},
			change(e) {
				this.current = e.detail.current
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pages {
		background-color: #fff;
		height:calc(100vh - 50px - env(safe-area-inset-bottom));
		overflow: hidden;
		.operation_reminder{
			position: fixed;
			left:50%;
			right:50%;
			transform: translate(-50%,-50%);
			top:50%;
			width: 620rpx;
			height:920rpx;
			.know{
				position: absolute;
				    left: 50%;
				    bottom: 24px;
				    content: '';
				    width: 221rpx;
				    height: 44rpx;
				    transform: translatex(-50%);
				    border-radius: 44px;
				    opacity: 0;
			}
			image{
				width: 100;
				display: block;
			}
		}
		.notice_warp {
			height: auto;
			background: #FF7612;

			.notice_icon {
				width: 82rpx;
				height: 27rpx;
				margin-left: 25rpx;
			}

		}

		.title_bar {
			padding: 28rpx 32rpx 28rpx 33rpx;

			.left_title {
				font-weight: bold;
				color: #000000;
				font-size: 30rpx
			}

			.right_btn {
				width: 162rpx;
				height: 64rpx;
				border: 2rpx solid #EDEDED;
				border-radius: 32rpx;

				text {
					font-size: 26rpx;
					font-weight: 400;
					color: #000000;
					padding: 0 8rpx 0 10rpx;
				}

				image {
					&:last-child {
						width: 16rpx;
						height: 10rpx;
					}

					&:first-child {
						width: 29rpx;
						height: 36rpx;
					}
				}
			}
		}

		.swiper_height {
			// height: calc(100% - 332rpx);
			width: 100%;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: center;
			box-sizing: border-box;
			flex-direction: column;

			.swiper {
				height: 100%;
				width: 100%;
				overflow: hidden;

				swiper-item {
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: center;
					width: 100%;
					height: 100%;
					box-sizing: border-box;
					flex-direction: column;

				}
			}
		}

		.item {
			background-color: #fff;
			border-radius: 20rpx;
			width: 638rpx;
			height: 100%;
			margin-bottom: 30rpx;
			box-sizing: border-box;
			  // padding-bottom: 0;
			  // padding-bottom: constant(safe-area-inset-bottom);
			  // padding-bottom: env(safe-area-inset-bottom);
			&.item1 {
				// margin-top:-20rpx;
				transform: scaleY(1);
			}

			&.item2 {
				transform: scaleY(0.98);
				// margin-top:20rpx;
			}

			.avatar {
				width: 100%;
				height: 100%;
				overflow: hidden;
				border-top-left-radius: 20rpx;
				border-top-right-radius: 20rpx;

				image {
					width: 100% !important;
					;
					height: 100%;
				}

				// background-color:red;
			}

			.item_botton {
				padding: 27rpx 29rpx 27rpx 33rpx;
				box-sizing: border-box;
				// height: 274rpx;
				width: auto;
				box-shadow: 0 0 20rpx 0 #efefef;
				border-radius: 0rpx 0rpx 20rpx 20rpx;
				box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.2);
				background-color: #fff;
				flex: 1;

				.item_top {
					padding: 4rpx 0rpx 23rpx 1rpx;
					box-sizing: border-box;

					text {
						font-weight: 400;

						&:first-child {
							font-size: 34rpx;
							;
							color: #000000;
						}

						&:last-child {
							color: #FF7612;
							font-size: 28rpx;
						}
					}

					.sex {
						width: auto;
						height: 28rpx;
						margin-left: 8rpx;
					}
				}

				.info_introduce {
					text {
						line-height: 40rpx;
						font-size: 28rpx;
						font-weight: 400;
						color: #111111;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 4;
						letter-spacing: 30;
					}
				}
			}
			
		}
		
	}
</style>
